package com.blu.blutemperaturecontrol.content;

import android.app.Activity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/11/7.
 */

public class StaticVariable {
    // Activity集合
    private static ArrayList<Activity> activityList = new ArrayList<Activity>();

    public static List<Activity> getActivityList() {
        return activityList;
    }

    /**
     * 添加activity到容器中
     */
    public static void addActivity(Activity activity) {
        activityList.add(activity);
    }

    /**
     * 遍历所有的Activiy并finish
     */
    public static void exit() {
        try {
            for (int i = 0;i<activityList.size();i++){
//                if(activityList.get(i) != null && !(activityList.get(i) instanceof LoginActivity)){
//                    activityList.get(i).finish();
//                }
            }
            activityList.clear();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
